package com.qf.application.controller;


import com.qf.application.entity.Operators;
import com.qf.application.service.OperatorsService;
import com.qf.application.utils.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author l
 * @since 2024-07-06
 */
@RestController
@RequestMapping("/operators")
public class OperatorsController {

    @Autowired
    private OperatorsService operatorsService;


    @PostMapping("/save")
    public Result addOperators(@RequestBody Operators operators){
        operators.setCreateTime(new Date());
        boolean save = operatorsService.save(operators);
        return  Result.success(save);
    }

    @PutMapping("/update")
    public Result updateOperByUserId(@RequestBody Operators operators){
        Boolean b = operatorsService.putOperByUserId(operators);
        return Result.success(b);
    }

}
